<?php
class Customer extends CI_Model {
    function get_Detail($id) {

        $this->db->where('id',$id);
        $query=$this->db->get("customer");
        return $query->row_array();

    }
    function get_Result($id) {
        $query = $this->db->query("SELECT
                                    customer.Id,
                                    customer.FirstName,
                                    customer.LastName,
                                    customer.Gender,
                                    customer.PermAdd,
                                    customer.PresAdd,                                  
                                    shiftconnection.result,
                                    shiftconnection.newaddress,
                                    shiftconnection.cause
                                    FROM
                                    customer
                                    Inner Join shiftconnection ON shiftconnection.appid = customer.Id
                                    WHERE
                                    customer.Id =  '$id'");
        return $query->row_array();
    }
    function get_profile($phone) {
        $query=$this->db->query("SELECT
                        customer.Id,
                        customer.FirstName,
                        customer.LastName,
                        customer.PresAdd,
                        customer.Birthday,
                        customer.Since,
                        customer.image,
                        telephone.phoneno
                        FROM
                        customer
                        Inner Join telephone ON customer.Id = telephone.Id
                        WHERE telephone.phoneno = '$phone'");
        return $query->row_array();
    }
    function get_image($phone) {

        $query=$this->db->query("SELECT
                              customer.image
                              FROM
                              customer
                              Inner Join telephone ON customer.Id = telephone.Id
                              WHERE telephone.phoneno = '$phone'");
        return $query->result();
    }

    function update_image($file,$id){

        $this->db->set('image',$file);
        $this->db->where('Id',$id);
        $this->db->update('customer');
    }



}
?>
